package day06;

public class MethodDemo2 {
    public static void main(String[] args) {
        say();
        sayHi("lisi");
        sayHello("lisi",120);

        double b  = getNum();
        System.out.println(b);

        int c =plus(100,100);
        System.out.println(c);

        int []d = Array2();
        for (int i = 0; i < d.length; i++) {
            System.out.println(d[i]);
        }
        //****************额外的延伸***************
        int[]e = Array(10,100);
        for (int i = 0; i < e.length; i++) {
            System.out.println(e[i]);
        }
    }
    public static void say(){
        System.out.println("lisi");
    }
    public static void sayHi(String name){
        System.out.println("My name is:"+name);
    }
    public static void sayHello(String name,double weight){
        System.out.println("我叫:"+name+"体重是:"+weight+"斤");
    }
    public static double getNum(){
        double a = 10.0;
        return a;
    }
    public static int plus(int m,int n){
        int sum =m+n;
        return sum;
    }
    public static int[] Array2(){
        int []arr2 = new int[10];
        for (int i = 0; i < arr2.length; i++) {
            arr2[i] =(int)(Math.random()*(20)+1);//填充1-20的随机数
        }
        return arr2;

    }
    //**************额外在延伸一下****************
    public static int [] Array(int len,int max){
        int[]arr = new int[len];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random()*max);
        }
            return arr;
    }
}



